#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
LL arr[N];
LL n, m, sum;
map<LL, bool>mp;
void dfs(LL x)
{
	if (mp[x]) {
		return;
	}
	mp[x] = 1;
	if (x <= 1) {
		return;
	}
	dfs(x / 2);
	dfs(x - x / 2);
}
int main()
{
	scanf("%lld%lld", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%lld", &arr[i]);
		sum += arr[i];
	}
	if (sum != n) {
		cout << "ham" << endl;
		return 0;
	}
	dfs(n);
	bool flag = 1;
	for (int i = 0; i < m; i++) {
		if (!mp[arr[i]]) {
			flag = 0;
		}
	}
	if (flag) {
		cout << "misaka" << endl;
	}
	else {
		cout << "ham" << endl;
	}
	return 0;
}